﻿using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Collections.Generic;
using System.Collections;
using System.IO;

namespace Distrackting.Parser
{
    public class Track
    {
        string nome;
        List<Waypoint> lista;

        public Track()
        {
            lista = new List<Waypoint>();
        }

        public Track(string no)
        {
            nome = no;
            lista = new List<Waypoint>();
        }

        public string getNome() { return nome; }
        public List<Waypoint> getLista() { return lista; }

        public void setNome(string no) { nome = no; }

        public void addWpt(Waypoint w) { lista.Add(w); }

        public void printTrack(StreamWriter tw)
        {
            tw.WriteLine("  <trk>");
            tw.WriteLine("    <name>" + nome + "</name>");
            tw.WriteLine("    <trkseg>");
            foreach (Waypoint w in lista) { w.printWpt(tw); }
            tw.WriteLine("    </trkseg>");
            tw.WriteLine("  </trk>");
        }
    }
}
